package com.ebo.synframework.nettybase.dispatcher;

import java.lang.reflect.InvocationTargetException;
import net.sf.cglib.reflect.FastMethod;

/**
 * <b>功能描述：</b>方法调用者<br>
 * <b>修改记录：</b><br>
 * @author yizhuan
 * @date 2011-12-21下午04:49:27<br>
 * TODO
 */
public class MethodInvoker {
    
    private final FastMethod fastMethod;
    
    private final Object instance;
    
    public MethodInvoker(FastMethod fastMethod, Object instance) {
        this.fastMethod = fastMethod;
        this.instance = instance;
    }
    
    /**
     * TODO the caller need to deal with exception
     * @throws InvocationTargetException 
     */
    public Object invoke(Object[] params) throws InvocationTargetException {
        return fastMethod.invoke(instance, params);
    }

}
